// 通用响应格式
export interface ApiResponse<T> {
  code: number;
  msg: string;
  data: T;
}

// 分页响应格式
export interface PageResult<T> {
  total: number;
  list: T[];
}

// 用户相关类型
export interface UserInfo {
  userID: number;
  username: string;
  email: string;
  avatar: string;
  role: string;
  isFrozen: string;
  createTime: string;
}

export interface UserListParams {
  page: number;
  pageSize: number;
}

export interface UserListResponse {
  total: number;
  list: UserInfo[];
}

// 课程相关类型
export interface CourseInfo {
  courseID: number;
  name: string;
  description: string;
  img: string;
  price: number;
  createTime: string;
}

export interface CourseListParams {
  page: number;
  pageSize: number;
}

export interface CourseListResponse {
  total: number;
  list: CourseInfo[];
}

export interface CourseDetail {
  courseID: number;
  name: string;
  description: string;
  img: string;
  price: number;
  chapters: ChapterInfo[];
}

// 章节相关类型
export interface ChapterInfo {
  chapterID: number;
  title: string;
  materials: MaterialInfo[];
}

export interface MaterialInfo {
  materialID: number;
  type: string;
  filePath: string;
}

// 统计相关类型
export interface CategoryStatistics {
  categoryID: number;
  categoryName: string;
  courseCount: number;
}

export interface WatchCountStatistics {
  courseID: number;
  courseName: string;
  watchCount: number;
}

// 权限映射
export const permissionMap = {
  course: {
    add: '2',
    update: '2',
    delete: '2',
    addChapter: '2',
    addMaterial: '2',
    updateMaterial: '2',
    deleteMaterial: '2'
  },
  user: {
    list: '3',
    freeze: '3',
    unfreeze: '3'
  },
  statistics: {
    category: '4',
    watchCount: '4'
  }
} as const; 